home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1989 …il & Dave's Excellent CD / Excellent CD HFS.raw / Moof / Goodies / MPW Goodies / Interfaces / AIncludes / HardwareEqu.a < prev    next >
Encoding:
Text File  |  1988-11-30  |  25.4 KB  |  755 lines  |  [TEXT/MPS ]

  1. ; Version: 1.04
  2. ; Created: Tuesday, August 2, 1988 at 9:29:09 PM
  3. ;
  4. ; File: HardwareEqu.a
  5. ;
  6. ; Assembler Interface to the Macintosh Libraries
  7. ; Copyright Apple Computer, Inc. 1984-1988
  8. ; All Rights Reserved
  9. ;
  10. ;--------------------------------------------------------------------
  11. ;
  12. ; The following information was formerly in "private" files that were
  13. ; not released to the general developer community.
  14. ;
  15. ; The information in this file is not needed for normal application
  16. ; development. These equates and macros were necessary for development
  17. ; of the Macintosh ToolBox and Operating System, and are likely to be
  18. ; dependent on their current implementation. Use of any information
  19. ; in this file is likely to cause your software to fail on future
  20. ; versions of Macintosh system software or hardware.
  21. ;
  22. ; Apple Developer Support will not support any use of the following
  23. ; information.
  24. ;
  25. ; In order to prevent any "accidental" use of this information, it has
  26. ; been disabled using the conditional-assembly variable, HWNonPortable,
  27. ; defined below. If you change this to a non-zero value, you're on your
  28. ; own. Since this gives hardware specific equates, we must also define
  29. ; which type of Mac we are assembling for. Define the following variable:
  30. ;
  31. ;            onMac if for 128K, 512K, 512Ke, or Mac+
  32. ;            onMacPP if for MacSE
  33. ;            onNuMac if for Macintosh II
  34. ;
  35. ; Hardware Equates -- This file defines the low-level equates for the
  36. ; Macintosh hardware interface.
  37. ;--------------------------------------------------------------------
  38.  
  39. ; If HWNonPortable is defined to be non-zero, Then a machine type must be specified!
  40.                 IF            (&TYPE('HWNonPortable') = 'UNDEFINED') THEN
  41. HWNonPortable    EQU         0
  42.                 ENDIF
  43.  
  44.                 IF            HWNonPortable THEN
  45.  
  46.                 IF            (&TYPE('onMac') = 'UNDEFINED') THEN 
  47. onMac            EQU         1
  48.                 ENDIF
  49.  
  50.                 IF            (&TYPE('onMacPP') = 'UNDEFINED') THEN
  51. onMacPP         EQU         0
  52.                 ENDIF
  53.  
  54.                 IF            (&TYPE('onNuMac') = 'UNDEFINED') THEN
  55. onNuMac         EQU         0
  56.                 ENDIF
  57.  
  58. ; Machine Configuration
  59.  
  60.                 IF            onMac THEN                ; ----- Mac -----
  61.  
  62. machine         EQU         0
  63. rom85Bits        EQU         $7F                     ; New ROMs, No Power Off.
  64.  
  65.                 ELSEIF        onNuMac THEN            ; ----- NuMac -----
  66. machine         EQU         1
  67. rom85Bits        EQU         $3F                     ; New ROMs, Power Off ability.
  68.  
  69.                 ELSEIF        onMacPP THEN            ; ----- MacPP -----
  70. machine         EQU         2
  71. rom85Bits        EQU         $7F                     ; New ROMs, No Power Off.
  72.  
  73.                 ENDIF
  74. DiagROM         EQU         $F80000                 ; Alternate ROM - initial vector
  75. DiagROM1        EQU         $F80080                 ; Alternate ROM - memory sizing vector
  76. DiagROM2        EQU         $F80088                 ; Alternate ROM - init I/O vector
  77. PhaseRead        EQU         $F00000                 ; Phase read address (StartMain)
  78.  
  79.  
  80. ;----------
  81. ; Processor Interrupt Masks
  82. ;----------
  83.  
  84.                 IF            onMac|onMacPP THEN        ; ----- Mac, MacPP -----
  85. hiIntMask        EQU         $0300
  86. loIntMask        EQU         $0100
  87. viaIntMask        EQU         $0100                    ; mask for VIA (and VBL) interrupts
  88. sccEnblMask     EQU         $F9FF                    ; mask to enable SCC interrupts
  89. sccIntMask        EQU         $200                    ; SCC interrupt vector
  90.  
  91.                 ELSEIF        onNuMac THEN            ; ----- NuMac -----
  92. hiIntMask        EQU         $0700                    ; mask for all interrupts
  93. sccIntMask        EQU         $0400                    ; SCC interrupt vector
  94. via2IntMask     EQU         $0200                    ; VIA2 interrupt vector
  95. slotIntMask     EQU         via2IntMask             ; slot's interrupt vector
  96. viaIntMask        EQU         $0100                    ; VIA interrupt vector
  97. loIntMask        EQU         $0100
  98. sccEnblMask     EQU         $FBFF                    ; mask to enable SCC interrupts
  99. pwrOffEnbl        EQU         $2500                    ; mask to allow poweroff interrupts
  100.  
  101.                 ELSEIF        onMacXL THEN            ; ----- MacXL -----
  102. hiIntMask        EQU         $0600                    ; mask for all interrupts (except NMI)
  103. loIntMask        EQU         $0100
  104.                 ENDIF
  105.  
  106.  
  107. ;----------
  108. ; Timing constants
  109. ;----------
  110.  
  111.                 IF            onMac|onMacPP THEN        ; ----- Mac, MacPP -----
  112. oneSec            EQU         95528                    ; looptimes
  113. halfSec         EQU         oneSec/2
  114. oneSecTicks     EQU         60                        ; ticks, of course
  115. stlDelay        EQU         $30                     ; default bus settle delay
  116.  
  117.                 ELSEIF        onNuMac THEN            ; ----- NuMac -----
  118. oneSec            EQU         382112                    ; looptimes
  119. halfSec         EQU         oneSec/2
  120. oneSecTicks     EQU         60                        ; ticks, of course
  121. stlDelay        EQU         $30                     ; default bus settle delay
  122.                 ENDIF
  123.  
  124.  
  125. ;----------
  126. ; Toolbox Trap Table equates
  127. ;----------
  128.  
  129. numOsTrap        EQU         256                     ; number of os traps
  130.  
  131.                 IF            onMac THEN                ; ----- Mac -----
  132. ToolTable        EQU         $0C00                    ; start of toolbox trap table
  133.  
  134.                 ELSE                                ; ----- Everyone Else -----
  135. ToolTable        EQU         $0E00                    ; start of toolbox trap table
  136.                 ENDIF
  137.  
  138.                 IF            onMac|onMacPP THEN        ; ----- Mac, MacPP -----
  139. numTbTrap        EQU         512                     ; number of toolbox traps
  140. numTrapMask     EQU         $01FF                    ; mask for number of tb traps
  141.  
  142.                 ELSEIF        onNuMac THEN            ; ----- NuMac -----
  143. numTbTrap        EQU         1024                    ; number of toolbox traps
  144. numTrapMask     EQU         $03FF                    ; mask for number of tb traps
  145.                 ENDIF
  146.  
  147.  
  148. ;----------
  149. ; Screen, Sound, ROM, RAM addresses
  150. ;----------
  151.  
  152. ramChk            EQU         1024                    ; Amount of memory tested for stack.
  153. OvlyRAM         EQU         $600000                 ; low RAM address when overlay is on
  154. OvlyScreen        EQU         $67A700                 ; top of screen with overlay
  155.  
  156.  
  157.                 IF            onMac|onMacPP THEN        ; ----- Mac, MacPP -----
  158. SoundLow        EQU         $3FFD00                 ; sound buffer start address
  159. PWMBuffer        EQU         $3FFD01                 ; PWM bytes are low bytes
  160. ROMStart        EQU         $400000                 ; starting address of ROM code
  161. ScreenLow        EQU         $3FA700                 ; top of screen screen address
  162. SERegs            EQU         $3FFC80                 ; Sys Error Regs w/o Overlay
  163. SEScrnNum        EQU         $3FD3DD                 ; Sys Error Number Screen address =$7CB5E+64*34 - 1
  164. ; "vaguely centered" plus 34 scanlines -1 for extra digit
  165. SEScrnInc        EQU         $3FD5DF                 ; address to diddle below death number
  166. SEScrnIcon        EQU         $3FCB5E                 ; centered screen addr for Mac icons
  167. SEScrnFace        EQU         $3FCCDF                 ; screen addr for face
  168. SEScrnI2        EQU         $3FCF1F                 ; screen addr for boot icon overlay
  169.  
  170.                 ELSEIF        onNuMac THEN            ; ----- NuMac -----
  171. ROMStart        EQU         $40800000                ; starting address of final ROM code
  172. ROM_hi            EQU         $40                     ; high byte of ROM address
  173. MaxAdr            EQU         $800000                 ; max RAM search address (8 MB)
  174. ramSiz            EQU         $40                     ; VIA2 bits setting to control RAM size
  175. SERegs            EQU         $0C30                    ; offset to Sys Error Regs w/o Overlay
  176. SEOvlyRegs        EQU         SERegs                    ; no overlay space for NuMac
  177.  
  178. ; offsets to various screen locations (tied to base address of screen)
  179.  
  180. SEScrnNum        EQU         $57A7                    ; Sys Error Number Screen address = $46A8+(128*34) - 1
  181. ; "vaguely centered" plus 34 scanlines -1 for extra digit
  182. SEScrnInc        EQU         $4AAA                    ; address to diddle below death number=$46A8+(128*8)+2
  183. SEScrnIcon        EQU         $46A8                    ; centered screen addr for NuMac icons
  184. SEScrnFace        EQU         $49A9                    ; screen addr for face = $46A8+(128*6)+1
  185. SEScrnI2        EQU         $4E29                    ; screen addr for boot icon overlay=$46A8+(128*15)+1
  186.                 ENDIF
  187.  
  188.                 IF            onMac THEN                ; ----- Mac -----
  189. ROMDoEject        EQU         $40001E                 ; jump to DoEject utility
  190. HeapStart        EQU         $1400                    ; Mac Plus starting point
  191. defSysHeap        EQU         $B700                    ; Default size of the system heap
  192. nDfltStackSize    EQU         $2000                    ; Default stack size
  193.                 ENDIF
  194.  
  195.                 IF            onMacPP THEN            ; ----- MacPP -----
  196. ROMDoEject        EQU         $40001E                 ; jump to DoEject utility
  197. HeapStart        EQU         $1600                    ; Aladdin starting point
  198. defSysHeap        EQU         $18000                    ; Default size of the system heap
  199. nDfltStackSize    EQU         $2000                    ; Default stack size
  200.                 ENDIF
  201.  
  202.                 IF            onNuMac THEN            ; ----- NuMac -----
  203. ROMDoEject        EQU         $4080001E                ; jump to DoEject utility
  204. HeapStart        EQU         $1E00                    ; need extra lomem for color quickdraw
  205. defSysHeap        EQU         $18000                    ; Default size of the system heap
  206. nDfltStackSize    EQU         $6000                    ; Default stack size
  207.                 ENDIF
  208.  
  209.  
  210. ;----------
  211. ; Screen, sound, ROM, RAM constants & offsets
  212. ;----------
  213.  
  214. ; Following should be defined for only Mac &
  215. ; MacPP, but this info not in video ROMS yet...
  216. scrnHorRes        EQU         72                        ; number of dots per inch horizontally
  217. scrnVertRes     EQU         72                        ; number of dots per inch vertically
  218. pwm2MemTop        EQU         $2FF                    ; PWMBuffer to MemTop
  219. snd2MemTop        EQU         $300                    ; SoundLow to Memtop
  220. sndBufWLen        EQU         $0172                    ; sound/disk buffer word length
  221.  
  222.                 IF            onMac|onMacPP THEN        ; ----- Mac, MacPP -----
  223. scrn2MemTop     EQU         $5900                    ; ScreenBase to Memtop
  224. scrnRowB        EQU         64                        ; bytes per scan line
  225. maxX            EQU         512                     ; number of pixels horizontally
  226. maxY            EQU         342                     ; number of pixels vertically
  227. screenWidth     EQU         maxX                    ; screen width
  228. screenHeight    EQU         maxY                    ; screen height
  229. scrnBytes        EQU         21888                    ; scrnRowB*maxY
  230. bufWorldSize    EQU         scrn2MemTop             ; total size of the BufPtr world
  231.  
  232.                 ELSEIF        onNuMac THEN            ; ----- NuMac -----
  233. bufWorldSize    EQU         snd2MemTop                ; total size of the BufPtr world
  234.                 ENDIF
  235.  
  236.                 IF            onMac THEN                ; ----- Mac -----
  237. romWSize        EQU         $10000                    ; 64K words in present ROM
  238. romBSize        EQU         $20000                    ; 128K bytes in present ROM
  239.  
  240.                 ELSEIF        onNuMac|onMacPP THEN    ; ----- NuMac, MacPP -----
  241. romWSize        EQU         $20000                    ; 128K words in present ROM
  242. romBSize        EQU         $40000                    ; 256K bytes in present ROM
  243.                 ENDIF
  244.  
  245.  
  246. ;----------
  247. ; Deep Shit Rectangle info
  248. ;----------
  249.  
  250.                 IF            onMac|onMacPP THEN        ; ----- Mac, MacPP -----
  251. dsRectTL        EQU         $00400020                ; top left = 64,32
  252. dsRectBR        EQU         $00BE01E0                ; bottom right = 190,480
  253.  
  254.                 ELSEIF        onNuMac THEN
  255.                                                     ; ----- NuMac -----
  256. dsRectTL        EQU         $00400020                ; top left = 64,32
  257. dsRectBR        EQU         $00BE01E0                ; bottom right = 190,480
  258. dsRectHei        EQU         (dsRectBR**$FFFF0000)-(dsRectTL**$FFFF0000)>>16
  259. dsRectLen        EQU         (dsRectBR**$FFFF)-(dsRectTL**$FFFF)
  260.                 ENDIF
  261.  
  262.  
  263. ;----------
  264. ; System Error, ROM Based Debugger Nub, MicroBug Equates
  265. ;----------
  266.  
  267.                 IF            onMac|onMacPP|onNuMac THEN
  268.                                                         ; ----- Mac, MacPP, NuMac -----
  269.  
  270. SEVars            EQU         SERegs                    ; start of system error data space (wrap city)
  271. seVSize         EQU         128                     ; # of bytes in space
  272. SED0            EQU         SEVars                    ; loc of saved reg D0
  273. SEA0            EQU         SED0+32                 ; loc of saved reg A0
  274. SEA7            EQU         SEA0+28                 ; loc of saved reg A7
  275. SEPC            EQU         SEA7+4                    ; loc of saved PC
  276. SESR            EQU         SEPC+4                    ; loc of saved SR
  277. SEAccess        EQU         SESR+2                    ; PC address during bus/address error
  278. SECmdSize        EQU         SEAccess+4                ; # of bytes of parameters passed in _debugger call
  279. SE000BE         EQU         SECmdSize+2             ; 8 bytes of bus error info for 68000
  280. SELastVar        EQU         SE000BE+8                ; last var in System Error data space
  281.  
  282.  
  283. ;-----
  284. ; ROM based debugger nub
  285. ;-----
  286.  
  287. rdPort            EQU         SELastVar                ; Number of port currently in use (0 => no link, 1 => A, 2 => B)
  288. rdCode            EQU         rdPort+2                ; Ptr to code download buffer.
  289. rdAtrap         EQU         rdCode+4                ; Saved Rom Atrap handler
  290. rdLowTrap        EQU         rdAtrap+4                ; low value for trap handling
  291. rdHiTrap        EQU         rdLowTrap+2             ; high value for trap handling
  292. rdResult        EQU         rdHiTrap+2                ; result of executing down-loaded code, etc. (16 bytes)
  293. rdEnd            EQU         rdResult+16             ; end of vars
  294.  
  295.  
  296. ;-----
  297. ; Microbug
  298. ;-----
  299.  
  300. ; NOTE: Keep mbDotAddr immediately before mBlocAddr
  301.  
  302. mbBufSize        EQU         34
  303. mbBuffer        EQU         SELastVar                ; buffer for input
  304. mbSign            EQU         mbBuffer+mbBufSize        ; ST => negative sign during conversion
  305. mbDotAddr        EQU         mbSign+2                ; saved address
  306. mBlocAddr        EQU         mbDotAddr+4             ; saved location
  307.                 ENDIF
  308.  
  309.  
  310. ;----------
  311. ; VIA (6522) interface chip addresses
  312. ;----------
  313.  
  314.                 IF            onMac|onMacPP THEN        ; ----- Mac, MacPP -----
  315. VBase            EQU         $EFE1FE                 ; base address
  316. AVBufB            EQU         $EFE1FE                 ; buffer B
  317. AVBufA            EQU         $EFFFFE                 ; buffer A
  318. AVBufM            EQU         $EFE1FE                 ; buffer with mouse button bit
  319. AVIFR            EQU         $EFFBFE                 ; interrupt flag register
  320. AVIER            EQU         $EFFDFE                 ; interrupt enable register
  321.  
  322.                 ELSEIF        onNuMac THEN    ; ----- NuMac -----
  323. VBase            EQU         $50F00000                ; base address
  324. AVBufB            EQU         VBase                    ; buffer B
  325. AVBufA            EQU         $50F01E00                ; buffer A
  326. AVBufM            EQU         VBase                    ; buffer with mouse button bit
  327. AVIFR            EQU         $50F01A00                ; interrupt flag register
  328. AVIER            EQU         $50F01C00                ; interrupt enable register
  329. VBase2            EQU         $50F02000                ; base for 2nd VIA
  330.                 ENDIF
  331.  
  332.  
  333. ;----------
  334. ; VIA offsets
  335. ;----------
  336.  
  337.                 IF            onMac|onMacPP|onNuMac THEN
  338.                                                         ; ----- Mac, MacPP, NuMac -----
  339. vBufB            EQU         0                        ; BUFFER B
  340. vBufAH            EQU         $200                    ; buffer a (with handshake) [ Dont use! ]
  341. vDIRB            EQU         $400                    ; DIRECTION B
  342. vDIRA            EQU         $600                    ; DIRECTION A
  343. vT1C            EQU         $800                    ; TIMER 1 COUNTER (L.O.)
  344. vT1CH            EQU         $A00                    ; timer 1 counter (high order)
  345. vT1L            EQU         $C00                    ; TIMER 1 LATCH (L.O.)
  346. vT1LH            EQU         $E00                    ; timer 1 latch (high order)
  347. vT2C            EQU         $1000                    ; TIMER 2 LATCH (L.O.)
  348. vT2CH            EQU         $1200                    ; timer 2 counter (high order)
  349. vSR             EQU         $1400                    ; SHIFT REGISTER
  350. vACR            EQU         $1600                    ; AUX. CONTROL REG.
  351. vPCR            EQU         $1800                    ; PERIPH. CONTROL REG.
  352. vIFR            EQU         $1A00                    ; INT. FLAG REG.
  353. vIER            EQU         $1C00                    ; INT. ENABLE REG.
  354. vBufA            EQU         $1E00                    ; BUFFER A
  355. vBufD            EQU         $1E00                    ; disk head select buffer
  356.                 ENDIF
  357.  
  358.                 IF            onMac THEN                ; ----- Mac -----
  359. ; === BUFFER A ===
  360. vAOut            EQU         $7F                     ; VBufA output bits
  361. vAInit            EQU         $69                     ; VBufA initial values (low volume)
  362. vSound            EQU         $7                        ; sound volume bits
  363. vSndPg2         EQU         3                        ; select sound page 2 if 0
  364. vOverlay        EQU         4                        ; overlay bit (overlay when 1)
  365. vHeadSel        EQU         5
  366. vPage2            EQU         6                        ; select video page 2 if 0
  367. vSCCWrReq        EQU         7                        ; SCC write/request line
  368.  
  369. ; === BUFFER B ===
  370. vBOut            EQU         $87                     ; VBufB output bits
  371. vBInit            EQU         $87                     ; VBufB initial values
  372. rtcData         EQU         0
  373. rtcClk            EQU         1
  374. rtcEnb            EQU         2                        ; enabled when 0
  375. vSW             EQU         3                        ; mouse switch (0 when down)
  376. vX2             EQU         4                        ; mouse X level
  377. vY2             EQU         5                        ; mouse Y level
  378. vH4             EQU         6                        ; horizontal sync
  379. vSndEnb         EQU         7                        ; /sound enable (reset when 1)
  380.  
  381.                 ELSEIF        onMacPP THEN            ; ----- MacPP -----
  382. ; === BUFFER A ===
  383. vAOut            EQU         $7F                     ; VBufA output bits
  384. vAInit            EQU         $69                     ; VBufA initial values (low volume)
  385. vSound            EQU         $7                        ; sound volume bits
  386. vSndPg2         EQU         3                        ; select sound page 2 if 0
  387. vDriveSel        EQU         4                        ; int drive select (lower drive when 1)
  388. vHeadSel        EQU         5
  389. vPage2            EQU         6                        ; select video page 2 if 0
  390. vSCCWrReq        EQU         7                        ; SCC write/request line
  391.  
  392. ; === BUFFER B ===
  393. vBOut            EQU         $C7                     ; VBufB output bits
  394. vBInit            EQU         $C7                     ; VBufB initial values
  395. rtcData         EQU         0
  396. rtcClk            EQU         1
  397. rtcEnb            EQU         2                        ; enabled when 0
  398. vFDBInt         EQU         3                        ; Front Desk bus interrupt
  399. vFDesk1         EQU         4                        ; bit for front desk bus
  400. vFDesk2         EQU         5                        ; and another
  401. vH4             EQU         6                        ; SCSI IRQ mask (was horiz. sync)
  402. vSndEnb         EQU         7                        ; /sound enable (reset when 1)
  403.  
  404. ; ELSE ; ----- NuMac -----
  405.                 ELSEIF        onNuMac THEN            ; ----- NuMac -----
  406.  
  407. ; === VIA1 BUFFER A ===
  408. vAOut            EQU         $3F                     ; VBufA output bits
  409. vAInit            EQU         $01                     ; VBufA initial values (low volume)
  410. vSound            EQU         $7                        ; sound volume bits (1..3)
  411. vSync            EQU         3                        ; Synchronous modem
  412. vOverlay        EQU         4                        ; overlay bit (overlay when 1)
  413. vHeadSel        EQU         5                        ; head select line for Sony
  414. vRev8Bd         EQU         6                        ; =0 for rev 8 board
  415. vSCCWrReq        EQU         7                        ; SCC write/request line
  416.  
  417. ; === VIA1 BUFFER B ===
  418. vBOut            EQU         $87                     ; VBufB output bits
  419. vBInit            EQU         $07                     ; VBufB initial values
  420. vRTCData        EQU         0                        ; real time clock data
  421. vRTCClk         EQU         1                        ; real time clock clock pulses
  422. vRTCEnb         EQU         2                        ; clock enable (0 for enable)
  423. vFDBInt         EQU         3                        ; Front Desk bus interrupt
  424. vFDesk1         EQU         4                        ; bit for front desk bus
  425. vFDesk2         EQU         5                        ; and another
  426.  
  427. ; === VIA1 IFR bits ===
  428. ifCA2            EQU         0                        ; CA2, ONESEC interrupt
  429. ifCA1            EQU         1                        ; CA1, VBL signal
  430. ifSR            EQU         2                        ; SR done, Serial i/o to Servo
  431. ifCB2            EQU         3                        ; CB2, Clock data
  432. ifCB1            EQU         4                        ; CB1, for clock pulse
  433. ifT2            EQU         5                        ; T2, INDEX pulse counter (VBL ctr)
  434. ifT1            EQU         6                        ; T1, (unused as interrupt)
  435. ifIRQ            EQU         7                        ; any interrupt
  436.  
  437. ; === VIA2 BUFFER A ===
  438. v2AOut            EQU         $C0                     ; V2BufA output bits
  439. v2AInit         EQU         $00                     ; V2BufA initial values
  440. v2RAMS            EQU         $C                        ; RAM size bits (6,7)
  441. v2IRQ1            EQU         0                        ; slot 1 interrupt
  442. v2IRQ2            EQU         1                        ; slot 2 interrupt
  443. v2IRQ3            EQU         2                        ; slot 3 interrupt
  444. v2IRQ4            EQU         3                        ; slot 4 interrupt
  445. v2IRQ5            EQU         4                        ; slot 5 interrupt
  446. v2IRQ6            EQU         5                        ; slot 6 interrupt
  447. v2RAM0            EQU         6                        ; RAM size bit 0
  448. v2RAM1            EQU         7                        ; RAM size bit 1
  449.  
  450. ; === VIA2 BUFFER B ===
  451. v2BOut            EQU         $80                     ; V2BufB output bits
  452. v2BInit         EQU         $05                     ; V2BufB initial values
  453. v2CDis            EQU         0                        ; cache disable (when 0)
  454. v2BusLk         EQU         1                        ; Bus lockout
  455. v2PowerOff        EQU         2                        ; soft power off signal (when 0)
  456. vFC3            EQU         3                        ; PMMU FC3 indicator
  457. v2TM1A            EQU         4                        ; bit for NUBus
  458. v2TM0A            EQU         5                        ; and another
  459. v2SCSIRQ        EQU         6                        ; SCSI interrupt request
  460. v2VBL            EQU         7                        ; pseudo VBL signal
  461. ; ENDIF ; {onOldNu}
  462.                 ENDIF                                ; {onNuMac}
  463.  
  464.  
  465. ;----------
  466. ; Timing constants
  467. ;----------
  468.  
  469.                 IF            onMac|onMacPP THEN        ; ----- Mac, MacPP -----
  470. ticksPr100        EQU         78                        ; timer 1 setting for 100 usec intervals
  471. oneSecConst     EQU         2                        ; gets converted to $20000 for oneSec constant
  472. flashDly        EQU         4                        ; icon flash delay count
  473. nTicks            EQU         780                     ; 780 ticks per msec
  474.  
  475.                 ELSEIF        onNuMac THEN            ; ----- NuMac -----
  476. ticksPr100        EQU         78                        ; timer 1 setting for 100 usec intervals
  477. oneSecConst     EQU         8                        ; gets converted to $80000 for oneSec constant
  478. flashDly        EQU         8                        ; icon flash delay count
  479. onemsDBRA        EQU         $0A3C                    ; about 1ms DBRA loop for Mac ][ (same as TimeDBRA)
  480. nTicks            EQU         780                     ; 780 ticks per msec
  481.                 ENDIF
  482.  
  483.  
  484. ;----------
  485. ; SCC Serial Chip Addresses
  486. ;----------
  487.  
  488.                 IF            onMac|onMacPP THEN        ; ----- Mac, MacPP -----
  489. SCCRBase        EQU         $9FFFF8                 ; SCC base read address
  490. SCCWBase        EQU         $BFFFF9                 ; SCC base write address
  491.  
  492.                 ELSEIF        onNuMac THEN            ; ----- NuMac -----
  493. SCCRBase        EQU         $50F04000                ; SCC base read address
  494. SCCWBase        EQU         $50F04000                ; SCC base write address
  495.                 ENDIF
  496.  
  497.  
  498. ;----------
  499. ; SCC Offsets
  500. ;----------
  501.  
  502. aData            EQU         6                        ; offset for A channel data
  503. aCtl            EQU         2                        ; offset for A channel control
  504. bData            EQU         4                        ; offset for B channel data
  505. bCtl            EQU         0                        ; offset for B channel control
  506. sccData         EQU         4                        ; general offset for data from control
  507. rxBF            EQU         0                        ; SCC receive buffer full
  508. txBE            EQU         2                        ; SCC transmit buffer empty
  509.  
  510.  
  511.                 IF            onMac|onMacPP THEN        ; ----- Mac, MacPP -----
  512. sccWrite        EQU         $200001                 ; general offset for write from read
  513.  
  514.                 ELSEIF        onNuMac THEN            ; ----- NuMac -----
  515. sccWrite        EQU         $0                        ; general offset for write from read
  516.                 ENDIF
  517.  
  518.  
  519. ;----------
  520. ; SCC Clock Rates, Baud Rate Constants
  521. ;----------
  522.  
  523. macClock        EQU         36707                    ; in Hz * 100
  524. midMacClock     EQU         39168
  525. nuMacClock        EQU         36864
  526. lisaAClock        EQU         40000                    ; port A clock
  527. lisaBCLock        EQU         36864                    ; port B clock
  528. macConst        EQU         114709                    ; in Hz/32
  529. midMacConst     EQU         122400
  530. nuMacConst        EQU         115200
  531. lisaAConst        EQU         125000
  532. lisaBConst        EQU         115200
  533.  
  534.  
  535. ;----------
  536. ; IWM Chip Addresses
  537. ;----------
  538.  
  539.                 IF            onMac|onMacPP THEN        ; ----- Mac, MacPP -----
  540. DBase            EQU         $DFE1FF                 ; disk address base
  541. DPh0L            EQU         $DFE1FF                 ; phase 0 low
  542. DPh0H            EQU         $DFE3FF                 ; phase 0 high
  543. DMtrOff         EQU         $DFF1FF                 ; IWM Motor off
  544. DMtrOn            EQU         $DFF3FF                 ; IWM Motor on
  545. DiskQ6L         EQU         $DFF9FF                 ; shift register
  546. DiskQ6H         EQU         $DFFBFF
  547. DiskQ7L         EQU         $DFFDFF
  548. DiskQ7H         EQU         $DFFFFF
  549.  
  550.                 ELSEIF        onNuMac THEN            ; ----- NuMac -----
  551. OldIWMBase        EQU         $50F1C000                ; old disk address base
  552. NewIWMBase        EQU         $50F16000                ; new disk address base
  553.                 ENDIF
  554.  
  555.  
  556. ;----------
  557. ; IWM Offsets
  558. ;----------
  559.  
  560. ph0L            EQU         0                        ; disk address offsets from base
  561. ph0H            EQU         $200
  562. ph1L            EQU         $400
  563. ph1H            EQU         $600
  564. ph2L            EQU         $800
  565. ph2H            EQU         $A00
  566. ph3L            EQU         $C00
  567. ph3H            EQU         $E00
  568. mtrOff            EQU         $1000
  569. mtrOn            EQU         $1200
  570. intDrive        EQU         $1400                    ; enable internal drive address
  571. extDrive        EQU         $1600                    ; enable external drive address
  572. q6L             EQU         $1800
  573. q6H             EQU         $1A00
  574. q7L             EQU         $1C00
  575. q7H             EQU         $1E00
  576.  
  577.  
  578. ;----------
  579. ; Interrupt Auto-vector and Exception Definitions
  580. ;----------
  581.  
  582. Line1010        EQU         $28                     ; 1010 emulator trap (system routines)
  583. Line1111        EQU         $2C                     ; 1111 emulator trap (reserved)
  584. FmtErrVect        EQU         $38                     ; format error vector for 68010/68020
  585. AutoInt1        EQU         $64                     ; level 1 auto-vector
  586. AutoInt2        EQU         $68                     ; level 2 auto-vector
  587. AutoInt3        EQU         $6C                     ; level 3 auto-vector
  588. AutoInt4        EQU         $70                     ; level 4 auto-vector
  589. AutoInt5        EQU         $74                     ; level 5 auto-vector
  590. AutoInt6        EQU         $78                     ; level 6 auto-vector
  591. AutoInt7        EQU         $7C                     ; level 7 auto-vector
  592.  
  593.  
  594. ;----------
  595. ; 53C80 SCSI Chip Addresses
  596. ;----------
  597.  
  598.                 IF            onMac THEN                ; ----- Mac -----
  599.  
  600. SCSIRd            EQU         $580000                 ; base addr SCSI interface - READ
  601. SCSIWr            EQU         $580001                 ; base addr SCSI interface - WRITE
  602. wrOffs            EQU         1                        ; write addrs are +1 to the read base
  603.  
  604.                 ELSEIF        onMacPP THEN            ; ----- MacPP -----
  605. SCSIRd            EQU         $5FF000                 ; base addr SCSI interface - READ
  606. SCSIWr            EQU         $5FF001                 ; base addr SCSI interface - WRITE
  607. MacSCSIBase     EQU         $5FF000                 ; base addr SCSI READ interface
  608. MacSCSIDMA        EQU         $5FF200                 ; base addr SCSI DMA
  609. MacSCSIHsk        EQU         $5FF200                 ; base addr SCSI handshake
  610. wrOffs            EQU         1                        ; write addrs are +1 to the read base
  611. TimeSCSIDB        EQU         $0B24                    ; DBRAs & SCSI access per millisecond
  612.  
  613.                 ELSEIF        onNuMac THEN            ; ----- NuMac -----
  614. OldSCSIBase     EQU         $50F10000                ; base addr SCSI interface
  615. OldSCSIDMA        EQU         $50F14000                ; base addr SCSI DMA
  616. OldSCSIHsk        EQU         $50F08000                ; base addr handshake
  617. NewSCSIBase     EQU         $50F10000                ; rev8 base addr SCSI interface
  618. NewSCSIDMA        EQU         $50F12000                ; rev8 base addr SCSI DMA (corrected)
  619. NewSCSIHsk        EQU         $50F06000                ; rev8 base addr SCSI handshake
  620. wrOffs            EQU         0                        ; write addrs are same as read base
  621. SCSIVct         EQU         AutoInt3                ; SCSI int at level 3
  622. TimeSCSIDB        EQU         $0DA6                    ; DBRAs & SCSI access per millisecond
  623.  
  624.                 ENDIF
  625.  
  626.  
  627. ;----------
  628. ; 53C80 Register Defs, Offsets
  629. ;----------
  630.  
  631.                 IF            onMac|onMacPP THEN        ; ----- Mac, MacPP -----
  632. ;(these are handshaking on MacPP)
  633. dACKRd            EQU         $200                    ; offset of psuedo-DMA - READ
  634. dACKWr            EQU         $200                    ; offset of psuedo-DMA - WRITE
  635.                 ENDIF
  636.  
  637.  
  638. sCDR            EQU         $00                     ; Current SCSI Read Data
  639. sODR            EQU         $00                     ; Output data register
  640. sICR            EQU         $10                     ; Initiator Command Register - READ/WRITE
  641. iRST            EQU         $80                     ; *RST asserted
  642. iAIP            EQU         $40                     ; arbitration in progress (read)
  643. bAIP            EQU         6                        ; bit test for arbitration in progress
  644. aTMD            EQU         $40                     ; assert Test Mode (write)
  645. iLA             EQU         $20                     ; Lost arbitration (read)
  646. bLA             EQU         5                        ; bit test for Lost Arbitration
  647. aDIFF            EQU         $20                     ; assert Differential enable (write)
  648. iACK            EQU         $10                     ; *ACK is asserted
  649. iBSY            EQU         $08                     ; *BSY is asserted
  650. iSEL            EQU         $04                     ; *SEL is asserted
  651. iATN            EQU         $02                     ; *ATN is asserted
  652. iDB             EQU         $01                     ; Data bus is asserted
  653. sMR             EQU         $20                     ; Mode Register - READ/WRITE
  654. iBDMA            EQU         $80                     ; Block Mode DMA
  655. iTGT            EQU         $40                     ; Target Mode
  656. iPTY            EQU         $20                     ; Enable Parity Checking
  657. iIPTY            EQU         $10                     ; Enable Parity interrupt
  658. iIEOP            EQU         $08                     ; Enable EOP interrupt
  659. iMBSY            EQU         $04                     ; Monitor BSY
  660. iDMA            EQU         $02                     ; DMA Mode
  661. iARB            EQU         $01                     ; Arbitration
  662. sTCR            EQU         $30                     ; Target Command Register - READ/WRITE
  663. iREQ            EQU         $08                     ; Assert *REQ
  664. iMSG            EQU         $04                     ; Assert *MSG
  665. iCD             EQU         $02                     ; Assert C/*D
  666. iIO             EQU         $01                     ; Assert I/*O
  667. sCSR            EQU         $40                     ; Current SCSI Bus Status (READ)
  668. aRST            EQU         $80                     ; *RST
  669. aBSY            EQU         $40                     ; *BSY
  670. bBSY            EQU         6                        ; bit test for *BSY
  671. aREQ            EQU         $20                     ; *REQ
  672. bREQ            EQU         5                        ; bit test for *REQ
  673. aMSG            EQU         $10                     ; *MSG
  674. bMSG            EQU         4                        ; bit test for *MSG
  675. aCD             EQU         $08                     ; C/*D
  676. bCD             EQU         3                        ; bit test for C/*D
  677. aIO             EQU         $04                     ; I/*O
  678. bIO             EQU         2                        ; bit test for I/*O
  679. aSEL            EQU         $02                     ; *SEL
  680. bSEL            EQU         1                        ; bit test for *SEL
  681. aDBP            EQU         $01                     ; *DBP
  682. sSER            EQU         $40                     ; Select Enable Register (WRITE)
  683. sBSR            EQU         $50                     ; Bus & Status Register (READ)
  684. iEDMA            EQU         $80                     ; End of DMA
  685. bEDMA            EQU         7                        ; bit test for end of DMA
  686. iDMAR            EQU         $40                     ; DMA Request
  687. bDMAR            EQU         6                        ; bit test for DMA Req
  688. iPERR            EQU         $20                     ; Parity Error
  689. iIREQ            EQU         $10                     ; Interrupt Request
  690. bIREQ            EQU         4                        ; bit test for interrupt
  691. iPM             EQU         $08                     ; Phase Match
  692. bPM             EQU         3                        ; bit test for Phase Match
  693. iBERR            EQU         $04                     ; Bus Error
  694. ATN             EQU         $02                     ; *ATN
  695. ACK             EQU         $01                     ; *ACK
  696. bACK            EQU         0                        ; bit test for ACK
  697. sDMAtx            EQU         $50                     ; DMA Transmit Start (WRITE)
  698. sIDR            EQU         $60                     ; Data input register (READ)
  699. sTDMArx         EQU         $60                     ; Start Target DMA receive (WRITE)
  700. sRESET            EQU         $70                     ; Reset Parity/Interrupt (READ)
  701. sIDMArx         EQU         $70                     ; Start Initiator DMA receive (WRITE)
  702.  
  703.  
  704.  
  705. ;----------
  706. ; Apple Sound Chip Addresses
  707. ;----------
  708.  
  709.                 IF            onNuMac THEN            ; ----- NuMac -----
  710. ;SoundChip EQU $50F18000 ; Base of sound chip's address space
  711. OldSndBase        EQU         $50F18000                ; old sound chip's base address
  712. NewSndBase        EQU         $50F14000                ; rev8 sound chip's base address
  713.                 ENDIF
  714.  
  715.  
  716. ;----------
  717. ; Hardware configuration bits.
  718. ;----------
  719.  
  720. ;the following goes with hwCfgFlags 
  721.  
  722. hwCbSCSI        EQU         15                        ; SCSI port present
  723. hwCbClock        EQU         14                        ; New clock chip present
  724. hwCbExPRAM        EQU         13                        ; Extra Parameter Ram valid.
  725. hwCbFPU         EQU         12                        ; FPU chip present.
  726. hwCbMMU         EQU         11                        ; Some kind of MMU present (see MMUType for what kind).
  727. hwCbADB         EQU         10                        ; Apple Desktop Bus present.
  728. hwCmSCSI        EQU         (1 << hwCbSCSI)
  729. hwCmClock        EQU         (1 << hwCbClock)
  730. hwCmExPRAM        EQU         (1 << hwCbExPRAM)
  731. hwCmFPU         EQU         (1 << hwCbFPU)
  732. hwCmMMU         EQU         (1 << hwCbMMU)
  733. hwCmADB         EQU         (1 << hwCbADB)
  734. fpuIn            EQU         12                        ; bit 12 - FPU chip installed
  735.  
  736.                 IF            onMac THEN
  737. hwCfgBits        EQU         hwCmSCSI++hwCmClock
  738.                 ELSEIF        onMacPP THEN
  739. hwCfgBits        EQU         hwCmSCSI++hwCmClock++hwCmADB
  740.                 ELSEIF        onNuMac THEN
  741. hwCfgBits        EQU         hwCmSCSI++hwCmClock++hwCmFPU++hwCmMMU++hwCmADB
  742.                 ELSE
  743.                 AERROR        'WARNING: Unknown machine type (hwCfgBits).'
  744.                 ENDIF
  745.  
  746.  
  747. ; Screen, Sound, ROM, RAM Constants
  748.                 IF            onMac|onMacPP THEN
  749. dVertRRate        EQU         60
  750.                 ENDIF
  751.  
  752.  
  753.  
  754.                 ENDIF
  755.